<template>
  <view style="display: flex;flex:1;flex-wrap: wrap">
    <image v-for="(item, index) in list" :key="index" :src="item" @tap="previewImage(item)" lazy-load mode="scaleToFill">
    </image>
  </view>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    previewImage(url) {
      const index = this.list.findIndex(value => value == url)
      uni.previewImage({
        urls: this.list,
        current: index,
        complete: () => {
          uni.setStorageSync('ispreviewImage', true)
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
image {
  width: 160rpx;
  height: 160rpx;
  margin-right: 10px;
  margin-bottom: 10px;
}
</style>